Skip to content

ci: add GitHub Actions workflow with a macOS end-to-end test - #11

Merged
ayuthmang merged 4 commits into
mainfrom
claude/add-ci
Oct 15, 2026
Merged

ayuthmang merged 4 commits into
mainfrom
claude/add-ci

Conversation

@ayuthmang

@ayuthmang ayuthmang commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Merge order: #6 and #7 are merged. This branch also includes #8 (merged in from claude/fix-hide-unhide-errors), because the workflow tests behavior that #8 adds: the tests, --version, and exit code 1 when the Desktop folder is missing. Merge #8 first and this PR's diff shrinks to just .github/workflows/ci.yml. If you merge this PR first instead, GitHub will mark #8 as merged too.

Problem

The project has no CI. Nothing would have caught the published 1.0.3 being unrunnable after npm install -g, or the CLI reporting success when chflags failed.

Fix

Adds .github/workflows/ci.yml:

  • Lint, test and build on Ubuntu with Node 18, 22 and 24.
  • End-to-end on macOS:
    • Runs npm pack, installs the tarball globally (as users do) and runs hide-files --version.
    • Creates a test Desktop with a folder, a filename with spaces, a $(…) filename and a .DS_Store.
    • Checks with stat -f %Sf that hide sets the hidden flag on every item except dotfiles, and that unhide clears it.
    • Checks that a missing Desktop folder exits non-zero.
  • Read-only contents permission, and cancels superseded runs.

Why CI was red before

The first runs on this PR failed at pnpm/action-setup because the branch predated #7, which adds the packageManager field. Merging main fixed that. Merging #8 supplies the tests and CLI behavior the workflow checks. Both merges were conflict-free, and nothing was rebased or force-pushed.

Verification

  • CI is green on this head (all four jobs, on both the push and pull-request runs): https://github.com/ayuthmang/hide-files/actions/runs/38036678674
  • Before pushing, I ran the same steps locally on Linux: pnpm install --frozen-lockfile, lint, test (13/13), build, npm pack plus a global install, --version, and the hide and missing-Desktop paths against a stub chflags.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Mgqw4V1jB7R9rpS2KrNkg

claude added 4 commits October 8, 2026 10:01
- Lint, test and build on Node 18, 22 and 24.
- On macOS, pack the CLI, install the tarball globally (as users do) and
  check with `stat -f %Sf` that `hide` sets the hidden flag on every
  Desktop item but not on dotfiles, that `unhide` clears it, and that a
  missing Desktop folder exits non-zero. This would have caught both the
  missing shebang and the silent failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Mgqw4V1jB7R9rpS2KrNkg
Previously the CLI printed "hidden! 🤫" before chflags even started,
discarded its stderr, and always exited 0. On a non-macOS machine, with an
empty Desktop, or when chflags failed, users were told it had worked.

- Move the filesystem work into src/desktop.ts: list the Desktop with
  readdir (skipping dotfiles, as the shell's `*` glob did) and pass the
  paths straight to `chflags` with execFile. No shell means no hand-rolled
  quoting; the old `replaceAll(' ', '" "')` only handled spaces.
- Print the success message only after chflags succeeds. On failure, show
  chflags' stderr (or the error, e.g. a missing Desktop folder) and exit
  with status 1.
- Fail fast with a clear message when not running on macOS.
- Say so when there is nothing on the Desktop to change instead of
  running `chflags hidden ~/Desktop/*` against an unmatched glob.
- Add `--version`, a program name and a description.
- Use parseAsync now that the actions are async.
- Add the first tests (13 cases): setHidden against a real temp directory
  with awkward filenames, and the CLI with the filesystem layer mocked so
  it runs on any OS. `pnpm test` previously failed with "No tests found".
- Lint the test files: drop the type-aware `parserOptions.project`, which
  no enabled rule needs and which rejects files excluded from the build
  tsconfig. Drop `jest` from tsconfig `types`; tests import from
  @jest/globals and are not part of the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Mgqw4V1jB7R9rpS2KrNkg
@ayuthmang
ayuthmang marked this pull request as ready for review October 10, 2026 08:06
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@ayuthmang
ayuthmang merged commit c1ca6a5 into main Oct 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants